#include <iostream>
#include <vector>
#include <string>
#include <memory>

using namespace std;

class Employee {
public:
    string name;
    float salary;
    Employee(string name, float salary) : name(name), salary(salary) {}
    virtual void CalculateSalary() = 0;

};

class SalariedEmployee : public Employee {
public:
    SalariedEmployee(string name, float salary) : Employee(name, salary) {} // Corrected here
    void CalculateSalary() override {
        cout << name << "'s salary(monthly) totally is " << salary << endl;
    }
};

class HourlyEmployee : public Employee {
private:
    int hours;
public:
    HourlyEmployee(string name, float salary, int h) : Employee(name, salary), hours(h) {} // Corrected here
    void CalculateSalary() override {
        cout << name << "'s salary(hourly) totally is " << salary * hours << endl;
    }
};

int main() {
    // 员工名称数组
    vector<string> employee_names = {
        "Louis", "Lino", "Mike", "Lily", "Tom", "Grace", "Moly", "Ronald", "Wilson", "Kelly"
    };

    // 小时工时薪数组
    vector<float> hourly_salaries = {58.16, 50.38, 59.23, 59.46, 52.75, 47.98, 51.05, 56.78, 53.37, 40.95};

    // 小时工工时数组
    vector<int> hours_worked = {5, 4, 5, 6, 5, 6, 7, 4, 6, 4};

    // 月薪工作人员月薪数组
    vector<float> monthly_salaries = {
        21737.09, 22517.04, 18739.86, 12029.53, 15657.3, 13136.08, 15159.52, 20597.57, 21609.91, 18660.92
    };

    // 0-1数组（0对应小时工，1对应月薪工作者）
    vector<int> employee_types = {1,1,0,1,0,0,1,1,1,1};

    vector<unique_ptr<Employee>> employees;

    for (int i = 0; i < 10; i++) {
        if (employee_types[i] == 0) {
            employees.push_back(make_unique<HourlyEmployee>(employee_names[i], hourly_salaries[i], hours_worked[i]));
        } else {
            employees.push_back(make_unique<SalariedEmployee>(employee_names[i], monthly_salaries[i]));
        }
    }

    // 计算并输出每个员工的薪水
    for (auto& employee : employees) {
        employee->CalculateSalary();
    }

    return 0;
}
